<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <link rel="stylesheet" type="text/css" href="../../static/admin/layui/css/layui.css"/>
    <link rel="stylesheet" type="text/css" href="../../static/admin/css/admin.css"/>
</head>
<body>
<div class="layui-tab page-content-wrap">
    <div class="layui-tab-content">
        <div class="layui-tab-item layui-show">
            <form class="layui-form"  style="width: 90%;padding-top: 20px;">
                {% csrf_token %}
                <div class="layui-form-item ">
                    <label class="layui-form-label">存放路径：</label>
                    <div class="layui-input-block">
                        <input type="save_path" name="save_path" disabled lay-verify="required" autocomplete="off" class="layui-input" value={{path}}>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">临时目录：</label>
                    <div class="layui-input-block">
                        <input type="catalog" name="catalog" lay-verify="required" autocomplete="off" class="layui-input" value={{temp_path}}>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">采集次数：</label>
                    <div class="layui-input-block">
                        <input type="cj_conut" name="cj_conut" lay-verify="number" autocomplete="off" class="layui-input" value={{cjcs}}>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">采集间隔：</label>
                    <div class="layui-input-block">
                        <input type="cj_time" name="cj_time" lay-verify="number" autocomplete="off" class="layui-input" value={{jgsj}}>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">登录时长：</label>
                    <div class="layui-input-block">
                        <input type="login_time" name="login_time" lay-verify="number" autocomplete="off" class="layui-input" value={{dqsj}}>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">是否启用：</label>
                    <div class="layui-input-block">
                        {{ sfqy | safe }}
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        {% if anzs == 1 %}
                        <button class="layui-btn" lay-submit lay-filter="adminInfo" style="margin-top: 30px">保存</button>
                        {% else %}
                        <button class="layui-btn layui-hide" lay-submit style="margin-top: 30px">保存</button>
                        {% endif %}
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
</body>
</html>
<script src="../../static/admin/layui/layui.js" type="text/javascript" charset="utf-8"></script>
<script src="../../static/js/jquery-3.3.1.min.js" type="text/javascript" charset="utf-8"></script>
<script src="/static/js/jquery.cookie.js" ></script>
<script>
    layui.use(['form','element'], function() {
        var form = layui.form();
        re_url = "{{url_data|safe}}";

        form.on('submit(adminInfo)', function(data){
            var index = layer.load(2, {shade: [0.2, '#5B5B5B']});
            $.ajax({
                url: 'face_gather.html',
                type: 'POST',
                data:{'key': 'update','base':data.field,'type':re_url},
                headers:{'X-CSRFtoken':$.cookie('csrftoken')},
                success: function (base) {
                    if (base == 'true'){
                        layer.msg('信息保存成功！', {icon: 1});
                        setTimeout("window.location.reload();", 2000 )
                    }else if(base == 'false'){
                        layer.msg('你没有操作权限，请联系系统管理员！', {icon: 2});
                        setTimeout("window.location.reload();", 2000 )
                    }else {
                        layer.close(index);
                        layer.msg('信息保存失败，请联系系统管理员！', {icon: 2});
                    }
                }
            })
            return false;
        })
    })
</script>